package cn.springcloud.fix.auth.controller;

import cn.springcloud.fix.auth.api.feign.RemoteAuthService;
import cn.springcloud.fix.auth.api.request.CheckPermissionRequest;
import cn.springcloud.fix.auth.api.response.CheckPermissionResponse;
import cn.springcloud.fix.common.core.base.R;
import cn.springcloud.fix.common.core.enums.ResponseEnum;
import lombok.AllArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@AllArgsConstructor
@RequestMapping("/v1")
public class AuthController implements RemoteAuthService {

    @Override
    public R<String> hasPermission(@RequestParam("url") String url,
                                   @RequestParam("method") String method,
                                   @RequestHeader(HttpHeaders.AUTHORIZATION) String authentication) {
        return R.SUCCESS();
    }

    @Override
    public R<String> hasPermission2(String url) {
        return R.SUCCESS();
    }

    @Override
    @GetMapping("/permission4")
    public R<String> hasPermission3(@RequestParam Map<String, String> param) {
        return R.SUCCESS();
    }

    @Override
    @RequestMapping("/checkPermission")
    public CheckPermissionResponse checkPermission(@RequestBody CheckPermissionRequest request) {
        CheckPermissionResponse response = new CheckPermissionResponse();
        // response.setResponseEnum(ResponseEnum.SUCCESS);
        return response;
    }
}
